package com.wuzao.wrapperClassTest.characterTest;

public class CharacterTest {
    public static void main(String[] args) {
        // 方法 1: 使用 'a' + 1
        char ch1 = 'a' + 1;
        Character character1 = new Character(ch1);
        System.out.println("Method 1: " + character1); // 输出 'b'

        // 方法 2: 将整数强制转换为 char
        int num = 98;
        char ch2 = (char) num;
        Character character2 = new Character(ch2);
        System.out.println("Method 2: " + character2); // 输出 'b'

        // 方法 3: 自动装箱
        int num2 = 99;
        char ch3 = (char) num2;
        Character character3 = ch3; // 自动装箱
        System.out.println("Method 3: " + character3); // 输出 'c'

        // 方法 4: 使用 Character.valueOf()
        int num3 = 100;
        char ch4 = (char) num3;
        Character character4 = Character.valueOf(ch4);
        System.out.println("Method 4: " + character4); // 输出 'd'
    }
}